﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-tw" />
<title>團體及學校參觀申請表</title>
<link rel="stylesheet" media="screen" type="text/css"  href="/eform/css/visitform.css" />
<script type="text/javascript" src="/eform/js/visitform.js"></script>
<script type="text/javascript" src="/eform/js/cal2.js"></script>
<script type="text/javascript" src="/eform/js/cal_conf2.js"></script>
<script type="text/javascript" src="/eform/js/gen_validatorv31.js"></script>
<script type="text/javascript" src="/js/lib/prototype.js"></script>
<script type="text/javascript" src="/js/lib/inputmask.js"></script>
</head>
<%
Function IIf(condition,value1,value2)
	If condition Then IIf = value1 Else IIf = value2
End Function
%>
<body onLoad="Xaprb.InputMask.setupElementMasks()">
    <div id="visitform">
        <h2>線上團體及學校參觀申請表</h2>
        <form name="visitform" method="post" action="/eform/Submit.asp">
          <input type="hidden" name="Language" value="chi" />
          <table class="visitForm">
            <tr>
              <th>團體(學校)名稱</th>
              <td>
                 <!--#include file="SchoolId.asp"--><br />
                 <input type="text" id="schoolname" name="name" width="100" size="40" value='<% =Request.Cookies("Applicant")("name") %>' />
                 <!--#include file="../schoolid_scr.asp"-->
              </td>
            </tr>
            <tr>
              <th>地址</th>
              <td><textarea rows="3" name="address" cols="40"><% =Request.Cookies("Applicant")("address") %></textarea></td>
            </tr>
            <tr>
              <th>聯絡人姓名</th>
              <td><input type="text" name="contactPerson" size="40" value='<% =Request.Cookies("Applicant")("contactPerson") %>' /></td>
            </tr>
            <tr>
              <th>聯絡人電話</th>
              <td><input type="text" name="contactPhone" size="40" value='<% =Request.Cookies("Applicant")("contactPhone") %>' /></td>
            </tr>
            <tr>
              <th>傳真機</th>
              <td><input type="text" name="fax" size="40" value='<% =Request.Cookies("Applicant")("fax") %>' /></td>
            </tr>
            <tr>
              <th>電郵地址 (e-mail)</th>
              <td><input type="text" name="email" size="40" value='<% =Request.Cookies("Applicant")("email") %>' /></td>
            </tr>
            <tr>
              <th>參觀人數 (一百人以內)</th>
              <td><input type="text" name="visitorsCount" size="10" class="input_mask mask_shortnumber" value='<% =Server.HTMLEncode(Request("visitorsCount")) %>' /></td>
            </tr>
            <tr>
              <th>隨行工作人員(老師)數目</th>
              <td><input type="text" name="teachersCount" size="10" class="input_mask mask_shortnumber" value='<% =Server.HTMLEncode(Request("teachersCount")) %>' /></td>
            </tr>
            <tr>
              <th>年齡層(年級)</th>
              <td><input type="text" name="ageClass" size="10" value='<% =Server.HTMLEncode(Request("ageClass")) %>' /></td>
            </tr>
            <tr>
              <th>預計參觀日期</th>
              <td><input type="text" name="visitDate" class="input_mask mask_date_us" size="12" value='<% =Server.HTMLEncode(Request("visitDate")) %>' /><a href="javascript:showCal('Calendar')">選擇日期</a>(dd/mm/yyyy)</td>
            </tr>
            <tr>
              <th>預計到館時間</th>
              <td><input type="text" name="arrivalTime" class="input_mask mask_shorttime" size="12" value='<% =Server.HTMLEncode(Request("arrivalTime")) %>' />(hh:mm)</td> 
            </tr>
            <tr>
              <th>預計離館時間</th>
              <td><input type="text" name="leaveTime" class="input_mask mask_shorttime" size="12" value='<% =Server.HTMLEncode(Request("leaveTime")) %>' />(hh:mm)</td>
            </tr>
            <tr>
              <th>導賞服務及參觀選項</th>
              <td>展覽項目編號<br/><input type="text" id="itemcode" name="activityCode" size="35" value='<% =Server.HTMLEncode(Request("activityCode")) %>' /><a href="javascript:openPopup('/eform/chi/ServiceGuide.html','',500,600)">選擇編號</a><br/><input type="checkbox" name="firstTime" <% =IIF(Request("firstTime")="ON", "checked", "") %> value="ON">第一次參觀博物館
              </td>
            </tr>
            <tr>
              <th>導賞語言</th>
              <td><input type="checkbox" name="cantonese" <% =IIF(Request.Cookies("Applicant")("cantonese")="ON","checked", "") %>  value="ON" />廣東話
                <input type="checkbox" name="putonghua" <% =IIF(Request.Cookies("Applicant")("putonghua")="ON","checked", "") %> value="ON" />普通話
                <input type="checkbox" name="portuguese" <% =IIF(Request.Cookies("Applicant")("portuguese")="ON","checked", "") %> value="ON" />Português
                <input type="checkbox" name="english" <% =IIF(Request.Cookies("Applicant")("english")="ON","checked","") %> value="ON" />English</td>
        
            </tr>
            <tr>
              <th>特別需要</th>
              <td><textarea rows="3" name="remarks" cols="40"><% =Server.HTMLEncode(Request("remarks")) %></textarea></td>
            </tr>
            <tr>
              <td class="submit" colspan="2">
              <% if Session("ErrorMsg")<>"" Then %>
              <font color='Red'><big><ul><% =Session("ErrorMsg") %></ul></big></font>
	          <%
	          Session("ErrorMsg")=""
	          end if
	          %>
              <input type="submit" name="Submit" value="遞交確認" />
              <input type="reset" name="Reset" value="重新填寫" />
              </td>
            </tr>
          </table>
        </form>
    </div>
<script type="text/javascript">
	var frmvalidator = new Validator("visitform");
	frmvalidator.EnableMsgsTogether();
	frmvalidator.addValidation("name","req","請填寫團體(學校)名稱");
	frmvalidator.addValidation("address","req","請填寫地址");
	frmvalidator.addValidation("contactPerson","req","請填寫聯絡人姓名");
	frmvalidator.addValidation("contactPhone","req","請填寫聯絡人電話");
	frmvalidator.addValidation("contactPhone","numeric","請填寫正確的聯絡人電話");
	frmvalidator.addValidation("email","email","請填寫正確的電郵地址");
	frmvalidator.addValidation("visitorsCount","req","請填寫參觀人數");
	frmvalidator.addValidation("teachersCount","req","請填寫隨行工作人員數目");
	frmvalidator.addValidation("visitDate","req","請填寫參觀日期");
	frmvalidator.addValidation("arrivalTime","req","請填寫到館時間");
	frmvalidator.addValidation("leaveTime","req","請填寫離館時間");
	
	var INVALID_VISITORS_DATE = "請選擇正確的參觀日期";
	var INVALID_ARRIVAL_TIME = "請填寫正確的到館時間";
	var INVALID_LEAVE_TIME = "請填寫正確的離館時間";
	var INVALID_ARRIVAL_GREATER = "離館時間不可以早過到館時間";
	
	frmvalidator.setAddnlValidationFunction("doCustomValidation");
	
	function doCustomValidation() {
		var frm = document.forms["visitform"];
		/*if (false == isFutureDate(frm)) {
			alert(INVALID_VISITORS_DATE);
			return false;
		}
		else {*/
		if (false == isValidArrivalTime(frm)) {
			alert(INVALID_ARRIVAL_TIME);
			return false;
		}
		else {
		if (false == isValidLeaveTime(frm)) {
			alert(INVALID_LEAVE_TIME);
			return false;
		}
		else { 
		if (false == isLeaveGreaterThanArrival(frm)) {
			alert(INVALID_ARRIVAL_GREATER );
			return false;
		}
		else {
			return true;
		}
		}
		}
		//}
	}
	
	function isFutureDate(frm) {
		var VisitDate = new Date(frm.visitDate.value);
		var Today = new Date();
		if (VisitDate < Today) {
			return false;
		}
		else {
			return true;
		}
	}
	
	function isValidArrivalTime(frm) {
		var ArrivalTime = frm.arrivalTime.value.split(":");
		var ArrivalHour = parseInt(ArrivalTime[0]);
		var ArrivalMinute = parseInt(ArrivalTime[1]);
		if ((ArrivalHour > 23 ) | (ArrivalMinute > 59)) {
			return false;
		}
		else {
			return true;
		}
	}
	
	function isValidLeaveTime(frm) {
		var LeaveTime = frm.leaveTime.value.split(":");
		var LeaveHour = parseInt(LeaveTime[0]);
		var LeaveMinute = parseInt(LeaveTime[1]);
		if ((LeaveHour > 23 ) | (LeaveMinute > 59)) {
			return false;
		}
		else {
			return true;
		}
	}
	
	function isLeaveGreaterThanArrival(frm) {
		var ArrivalTime = frm.arrivalTime.value.split(":");
		var LeaveTime = frm.leaveTime.value.split(":");
		var ArrivalHour = parseInt(ArrivalTime[0]);
		var ArrivalMinute = parseInt(ArrivalTime[1]);
		var LeaveHour = parseInt(LeaveTime[0]);
		var LeaveMinute = parseInt(LeaveTime[1]);
		var TotalArrivalTime = ArrivalHour*60+ArrivalMinute;
		var TotalLeaveTime = LeaveHour*60+LeaveMinute;
		if (TotalArrivalTime >= TotalLeaveTime) {
			return false;
		}
		else {
			return true;
		}
	}
	
</script>

</body>
</html>